package com.meilai.project.entity.business.sale;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.meilai.project.core.bean.SuperEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 销售单刊例总价周期表
 * </p>
 *
 * @author xhy
 * @since 2022-09-19
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("bill_sale_media_cycle")
@ApiModel(value = "BillSaleMediaCycle对象", description = "销售单刊例总价周期表")
public class BillSaleMediaCycle extends SuperEntity {
    @ApiModelProperty(value = "销售单id")
    private Long bill_sale_id;
    @ApiModelProperty(value = "月数")
    private Integer month;
    @ApiModelProperty(value = "天数")
    private Integer day;
    @ApiModelProperty(value = "每个月的天数 以逗号分割,")
    private String cycle;
    @ApiModelProperty(value = "天数数组")
    @TableField(exist = false)
    private int[] cycle_arr;

    public void setCycle(String cycle) {
        this.cycle = cycle;
        if (cycle != null) {
            String[] split = cycle.split(",");
            this.cycle_arr = new int[split.length];
            for (int i = 0; i < split.length; i++) {
                cycle_arr[i] = Integer.parseInt(split[i]);
            }
        }
    }
}
